import request from '@/utils/request.js'
export function getRoles(page, pagesize) {
  return request({
    url: '/sys/role',
    params: { page, pagesize }
  })
}

export const delRole = id => request.delete(`/sys/role/${id}`)
export const addRole = data => request.post(`/sys/role`, data)
export const updateRole = data => request.get(`/sys/role/${data.id}`, data)
// 获权详情
export function getRoleDetail(id) {
  return request({
    url: `/sys/role/${id}`
  })
}
/**
 * 给角色分配权限
 * @param {*} data {id:角色id, permIds:[] 所有选中的节点的id组成的数组}
 * @returns
 */
export function assignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
